home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / VXAVTOOL.ZIP / MISC-VIR.ZIP / VIROCRCK.ZIP / VIROCRK.ASM < prev    next >
Encoding:
Assembly Source File  |  1995-05-13  |  13.9 KB  |  574 lines

  1.  
  2. ;
  3. ; VIROCRK v2.0, (c)1995 √irogen [NuKE].
  4. ; ──────────────────────────────────────
  5. ; Sorry, didn't feel like commenting this. You see, if I go through
  6. ; the code and comment it then I'll no-doubt end up re-writing half
  7. ; of it also, and I just haven't got the time.
  8. ;
  9. ;
  10.  
  11. segment     cseg
  12.             assume  cs: cseg, ds: cseg, es: cseg, ss: cseg
  13.  
  14. lf          equ     0ah
  15. cr          equ     0dh
  16.  
  17. org         100h
  18. start:
  19.             lea     dx,intro
  20.             call    disp
  21.  
  22.             cmp     byte ptr ds: [80h],0
  23.             jnz     is_cmd_line
  24.             lea     dx,no_cmd_line
  25.             call    disp
  26.             ret
  27.  
  28. is_cmd_line:
  29.             mov     di,82h
  30.             mov     al,' '
  31.             mov     cx,0FFh
  32.             repnz   scasb
  33.             mov     si,di
  34.             dec     di
  35.             mov     byte ptr [di],0
  36.             lea     di,plain_text
  37.             mov     cx,0FFh
  38. copy_loop:
  39.             lodsb
  40.             cmp     al,cr
  41.             jz      quit_copy
  42.             stosb
  43.             loop    copy_loop
  44. quit_copy:
  45.             mov     ax,0ffh
  46.             sub     ax,cx
  47.             mov     plain_len,ax
  48.             mov     dx,82h
  49.             mov     ax,3d02h
  50.             int     21h
  51.             jnc     no_error
  52.             jmp     error
  53. no_error:
  54.  
  55.             xchg    ax,bx
  56.             lea     dx,buffer
  57.             mov     cx,0FFFEh-(offset buffer-offset start)-200h
  58.             mov     ah,3fh
  59.             int     21h
  60.             mov     bytes_read,ax
  61.             mov     ah,3eh
  62.             int     21h
  63.  
  64.             lea     dx,byte_xor_msg
  65.             call    disp
  66. xor8:
  67.             call    crack_byte_XOR
  68.             jnc     cont0
  69.             mov     cx,2
  70.             lea     si,key8
  71.             call    cvt_key
  72.             call    xor_b_crypt_ct
  73.             call    alright
  74.             call    xor_b_crypt_ct
  75.             inc     key8
  76.             jnz     xor8
  77. cont0:
  78.  
  79.  
  80.             call    reset
  81.             lea     dx,byte_add_msg
  82.             call    disp
  83.             mov     word ptr ext,'S8'
  84.             mov     byte ptr ext+2,'B'
  85. add8:
  86.             call    crack_byte_add
  87.             jnc     cont2
  88.             mov     cx,2
  89.             lea     si,key8
  90.             call    cvt_key
  91.             call    sub_b_crypt_ct
  92.             call    alright
  93.             call    add_b_crypt_ct
  94.             inc     key8
  95.             jnz     add8
  96. cont2:
  97.  
  98.             call    reset
  99.             lea     dx,byte_rot_msg
  100.             call    disp
  101.             mov     word ptr ext,'R8'
  102.             mov     byte ptr ext+2,'T'
  103. rot8:
  104.             call    crack_byte_rot
  105.             jnc     cont6
  106.             mov     cx,2
  107.             lea     si,key8
  108.             call    cvt_key
  109.             call    alright
  110.             inc     key8
  111.             cmp     key8,9
  112.             jnz     rot8
  113. cont6:
  114.  
  115.             call    reset
  116.             lea     dx,word_xor_msg
  117.             call    disp
  118.             mov     word ptr ext,'61'
  119.             mov     byte ptr ext+2,'X'
  120. xor16:
  121.             call    crack_word_XOR
  122.             jnc     cont1
  123.             mov     cx,4
  124.             lea     si,key16
  125.             call    cvt_key
  126.             call    xor_w_crypt_ct
  127.             call    alright
  128.             call    xor_w_crypt_ct
  129.             inc     key16
  130.             jnz     xor16
  131. cont1:
  132.  
  133.             call    reset
  134.             lea     dx,word_add_msg
  135.             call    disp
  136.             mov     word ptr ext,'61'
  137.             mov     byte ptr ext+2,'S'
  138. add16:
  139.             call    crack_word_add
  140.             jnc     cont4
  141.             mov     cx,4
  142.             lea     si,key16
  143.             call    cvt_key
  144.             call    sub_w_crypt_ct
  145.             call    alright
  146.             call    add_w_crypt_ct
  147.             inc     key16
  148.             jnz     add16
  149. cont4:
  150.  
  151.             call    reset
  152.             lea     dx,word_rot_msg
  153.             call    disp
  154.             mov     word ptr ext,'61'
  155.             mov     byte ptr ext+2,'R'
  156. rot16:
  157.             call    crack_word_rot
  158.             jnc     cont7
  159.             mov     cx,4
  160.             lea     si,key16
  161.             call    cvt_key
  162.             call    alright
  163.             inc     key16
  164.             cmp     key16,17
  165.             jnz     rot16
  166. cont7:
  167.  
  168.             cmp     adr_ct,offset buffer
  169.             jnz     did_adjust
  170.             lea     dx,adjust_msg
  171.             call    disp
  172.             inc     adr_ct
  173.             inc     adr_pt
  174.             dec     plain_len
  175.             jmp     cont1
  176. did_adjust:
  177.  
  178.  
  179.  
  180.             lea     dx,done_msg
  181.             call    disp
  182.             ret
  183.  
  184. alright:
  185.             lea     dx,fnd_msg
  186.             call    disp
  187.             lea     dx,fname
  188.             mov     ah,3Ch
  189.             xor     cx,cx
  190.             int     21h
  191.             xchg    ax,bx
  192.             lea     dx,buffer
  193.             mov     cx,bytes_read
  194.             mov     ah,40h
  195.             int     21h
  196.             mov     ah,3eh
  197.             int     21h
  198.  
  199.             ret
  200.  
  201. error:
  202.             lea     dx,error_msg
  203.             call    disp
  204.             ret
  205.  
  206.  
  207. setup_pt_ptr:
  208.             mov     cx,plain_len
  209.             mov     si,adr_pt
  210.             mov     di,si
  211.             ret
  212.  
  213. setup_ct_ptr:
  214.             mov     cx,bytes_read
  215.             mov     si,adr_ct
  216.             mov     di,si
  217.             ret
  218.  
  219.  
  220.  
  221. crack_byte_XOR:
  222.             inc     count
  223.             cmp     count,(0FFh/16)+1
  224.             jnz     nodispbx
  225.             mov     count,0
  226.             mov     dl,'.'
  227.             call    disp_char
  228. nodispbx:
  229.             call    xor_b_crypt_pt
  230.             call    search_file
  231.             pushf
  232.             call    xor_b_crypt_pt
  233.             popf
  234.             jc      done_b_xor
  235.             inc     key8
  236.             jnz     crack_byte_xor
  237. done_b_xor:
  238.             ret
  239.  
  240. xor_b_crypt_pt:
  241.             call    setup_pt_ptr
  242.             jmp     xor_b_loop
  243. xor_b_crypt_ct:
  244.             call    setup_ct_ptr
  245. xor_b_loop:
  246.             lodsb
  247.             xor     al,key8
  248.             stosb
  249.             loop    xor_b_loop
  250.             ret
  251.  
  252.  
  253. crack_word_XOR:
  254.             inc     count
  255.             cmp     count,0FFFFh/16
  256.             jnz     nodispwx
  257.             mov     count,0
  258.             mov     dl,'.'
  259.             call    disp_char
  260. nodispwx:
  261.             call    xor_w_crypt_pt
  262.             call    search_file
  263.             pushf
  264.             call    xor_w_crypt_pt
  265.             popf
  266.             jc      done_w_xor
  267.             inc     key16
  268.             jnz     crack_word_XOR
  269. done_w_xor:
  270.             ret
  271.  
  272.  
  273. xor_w_crypt_pt:
  274.             call    setup_pt_ptr
  275.             jmp     xor_w_loop
  276. xor_w_crypt_ct:
  277.             call    setup_ct_ptr
  278. xor_w_loop:
  279.             lodsw
  280.             mov     bx,key16
  281.             xchg    bl,bh
  282.             xor     ax,bx
  283.             stosw
  284.             dec     cx
  285.             jz      _ret
  286.             loop    xor_w_loop
  287. _ret:
  288.             ret
  289.  
  290.  
  291. crack_byte_ADD:
  292.             inc     count
  293.             cmp     count,(0FFh/16)+1
  294.             jnz     nodispba
  295.             mov     count,0
  296.             mov     dl,'.'
  297.             call    disp_char
  298. nodispba:
  299.             call    add_b_crypt_pt
  300.             call    search_file
  301.             pushf
  302.             call    sub_b_crypt_pt
  303.             popf
  304.             jc      done_b_add
  305.             inc     key8
  306.             jnz     crack_byte_add
  307. done_b_add:
  308.             ret
  309.  
  310. add_b_crypt_pt:
  311.             call    setup_pt_ptr
  312.             jmp     add_b_loop
  313. add_b_crypt_ct:
  314.             call    setup_ct_ptr
  315. add_b_loop:
  316.             lodsb
  317.             add     al,key8
  318.             stosb
  319.             loop    add_b_loop
  320.             ret
  321.  
  322. sub_b_crypt_pt:
  323.             call    setup_pt_ptr
  324.             jmp     sub_b_loop
  325. sub_b_crypt_ct:
  326.             call    setup_ct_ptr
  327. sub_b_loop:
  328.             lodsb
  329.             sub     al,key8
  330.             stosb
  331.             loop    sub_b_loop
  332.             ret
  333.  
  334. crack_word_ADD:
  335.             inc     count
  336.             cmp     count,0FFFFh/16
  337.             jnz     nodispwa
  338.             mov     count,0
  339.             mov     dl,'.'
  340.             call    disp_char
  341. nodispwa:
  342.             call    add_w_crypt_pt
  343.             call    search_file
  344.             pushf
  345.             call    sub_w_crypt_pt
  346.             popf
  347.             jc      done_w_add
  348.             inc     key16
  349.             jnz     crack_word_add
  350. done_w_add:
  351.             ret
  352.  
  353. add_w_crypt_pt:
  354.             call    setup_pt_ptr
  355.             jmp     add_w_loop
  356. add_w_crypt_ct:
  357.             call    setup_ct_ptr
  358. add_w_loop:
  359.             lodsw
  360.             add     ax,key16
  361.             stosw
  362.             dec     cx
  363.             jz      _retaw
  364.             loop    add_w_loop
  365. _retaw:
  366.             ret
  367.  
  368. sub_w_crypt_pt:
  369.             call    setup_pt_ptr
  370.             jmp     sub_w_loop
  371. sub_w_crypt_ct:
  372.             call    setup_ct_ptr
  373. sub_w_loop:
  374.             lodsw
  375.             sub     ax,key16
  376.             stosw
  377.             dec     cx
  378.             jz      _retsw
  379.             loop    sub_w_loop
  380. _retsw:
  381.             ret
  382.  
  383. crack_byte_rot:
  384.             mov     dl,'.'
  385.             call    disp_char
  386.             call    ror_b_crypt_ct
  387.             call    search_file
  388.             jc      done_b_rot
  389.             inc     key8
  390.             cmp     key8,9
  391.             jnz     crack_byte_rot
  392. done_b_rot:
  393.             pushf
  394.             cmp     key8,8
  395.             jnz     brot_ok
  396.             popf
  397.             clc
  398.             ret
  399. brot_ok:
  400.             popf
  401.             ret
  402.  
  403.             ret
  404.  
  405. ror_b_crypt_ct:
  406.             call    setup_ct_ptr
  407. ror_b_loop:
  408.             lodsb
  409.             ror     al,1
  410.             stosb
  411.             loop    ror_b_loop
  412.             ret
  413.  
  414. crack_word_rot:
  415.             mov     dl,'.'
  416.             call    disp_char
  417.             call    ror_w_crypt_ct
  418.             call    search_file
  419.             jc      done_w_rot
  420.             inc     key16
  421.             cmp     key16,17
  422.             jnz     crack_word_rot
  423. done_w_rot:
  424.             pushf
  425.             cmp     key16,16
  426.             jnz     wrot_ok
  427.             popf
  428.             clc
  429.             ret
  430. wrot_ok:
  431.             popf
  432.             ret
  433.  
  434. ror_w_crypt_ct:
  435.             call    setup_ct_ptr
  436. ror_w_loop:
  437.             lodsw
  438.             ror     ax,1
  439.             stosw
  440.             dec     cx
  441.             jz      ror_w_done
  442.             loop    ror_w_loop
  443. ror_w_done:
  444.             ret
  445.  
  446.  
  447.  
  448.  
  449. search_file:
  450.             mov     cx,bytes_read
  451.             mov     si,adr_ct
  452.             dec     si
  453. search_loop0:
  454.             mov     di,adr_pt
  455. search_loop:
  456.             mov     ax,di
  457.             sub     ax,adr_pt
  458.             cmp     ax,plain_len
  459.             jz      got_it
  460.             inc     si
  461.             mov     al,byte ptr [di]
  462.             cmp     al, byte ptr [si]
  463.             jz      got_one
  464.             loop    search_loop0
  465.             jmp     not_found
  466. got_one:
  467.             inc     di
  468.  
  469.             loop    search_loop
  470. not_found:
  471.             clc
  472.             ret
  473. got_it:
  474.             stc
  475.             ret
  476.  
  477.  
  478. cvt_key:
  479.             lea     di,key_txt+3
  480. cvt_key_l0:
  481.             call    cvt_byte
  482.             sub     cx,2
  483.             jnz     cvt_key_l0
  484.             ret
  485.  
  486. cvt_byte:
  487.             push    cx
  488.             mov     al,byte ptr [si]
  489.             inc     si
  490.             push    ax
  491.             mov     cx,4
  492.             shl     al,cl
  493.             shr     al,cl
  494.             call    to_ascii
  495.             mov     byte ptr [di],al
  496.             dec     di
  497.             pop     ax
  498.             shr     al,cl
  499.             call    to_ascii
  500.             mov     byte ptr [di],al
  501.             dec     di
  502.             pop     cx
  503.             ret
  504.  
  505. to_ascii:
  506.             cmp     al,9
  507.             jg      is_alpha
  508.             add     al,'0'
  509.             ret
  510. is_alpha:
  511.             add     al,'A'-10
  512.             ret
  513.  
  514.  
  515. reset:
  516.             mov     key8,1
  517.             mov     key16,1
  518.             mov     count,0
  519.             mov     word ptr key_txt,'00'
  520.             mov     word ptr key_txt+2,'00'
  521.             ret
  522.  
  523. disp_char:
  524.             mov     ah,2
  525.             int     21h
  526.             mov     ah,0bh
  527.             int     21h
  528.             cmp     al,0
  529.             jz      no_key
  530.             lea     dx,user_abort
  531.             call    disp
  532.             mov     ax,4c01h
  533.             int     21h
  534. no_key:
  535.             ret
  536. disp:
  537.             mov     ah,9
  538.             int     21h
  539.             ret
  540.  
  541. intro:
  542.  db      cr,lf,'┌──────────────────────────────────────────┐'
  543.  db      cr,lf,"│ √irogen's Super-Duper Encryption Cracker │  [√] FDA Approved"
  544.  db      cr,lf,'│ ──────────────────────────────────────── │  [√] FCC Class B Appliance'
  545.  db      cr,lf,'│ version 2.0 ; (c)1995 √irogen [NuKE]     │  [√] Love Me, Fuck Me, Kill Me'
  546.  db      cr,lf,'└──────────────────────────────────────────┘$'
  547. byte_add_msg db     cr,lf,'  Attempting 8-bit ADD/SUB  .$'
  548. byte_xor_msg db     cr,lf,'  Attempting 8-bit XOR      .$'
  549. byte_rot_msg db     cr,lf,'  Attempting 8-bit ROR/ROL  .$'
  550. word_xor_msg db     cr,lf,'  Attempting 16-bit XOR     .$'
  551. word_add_msg db     cr,lf,'  Attempting 16-bit ADD/SUB .$'
  552. word_rot_msg db     cr,lf,'  Attempting 16-bit ROR/ROL .$'
  553. adjust_msg  db      cr,lf,'  Adjusting 16-bit Addressing$'
  554. user_abort  db      cr,lf,cr,lf, ' Key Input Detected. Process Aborted. ',cr,lf,'$'
  555. done_msg    db      cr,lf,cr,lf,'  All keys exhausted.',cr,lf,'$'
  556. fnd_msg     db      cr,lf,'     Possible key found! Writing decrypted file: '
  557. fname       db      'DEC-'
  558. key_txt     db      '0000.'
  559. ext         db      '8XR',0,'$'
  560. error_msg   db      cr,lf,cr,lf,'Error opening file! Usage: VIROCRK [filename] [search text]',cr,lf,'$'
  561. no_cmd_line db      cr,lf,cr,lf,'No command line. Usage: VIROCRK [filename] [search text]',cr,lf,'$'
  562. plain_len   dw      0
  563. plain_text  db      128 dup (0)
  564. bytes_read  dw      0
  565. key8        db      1
  566. key16       dw      1
  567. count       dw      0
  568. adr_pt      dw      offset plain_text
  569. adr_ct      dw      offset buffer
  570. buffer:
  571. cseg        ends
  572.             end     start
  573.  
  574.